package com.wqr.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.wqr.dao.UserTypesDao;
import com.wqr.pojo.UserTypes;
import com.wqr.pojo.UserTypesExample;

@Service
public class UserTypesServiceImp implements UserTypesService{
	@Autowired
	public UserTypesDao userTypesDao;
	
	public List<UserTypes> list() throws Exception {
		UserTypesExample example = new UserTypesExample();
		List<UserTypes> list = userTypesDao.selectByExample(example);
		return list;
	}

	public int delectUserTypes(Integer userTypeId) throws Exception {
		int a = userTypesDao.deleteByPrimaryKey(userTypeId);
		if(a > 0) {
			return 1;
		}else {
			return 0;
		}
	}
	public int insertUserTypes(UserTypes userTypes) throws Exception {
		int a = userTypesDao.insertSelective(userTypes);
		if(a > 0) {
			return 1;
		}else {
			return 0;
		}
	}
	public int updateUserTypes(UserTypes userTypes) throws Exception {
		int a = userTypesDao.updateByPrimaryKey(userTypes);
		if(a > 0) {
			return 1;
		}else {
			return 0;
		}
	}

	public List<UserTypes> selectUserTypes(UserTypes userTypes) throws Exception {
		List<UserTypes> list = userTypesDao.selectByWhere(userTypes);
		return list;
	}

	public UserTypes selectByPrimaryKey(Integer userTypeId) throws Exception {
		UserTypes list = userTypesDao.selectByPrimaryKey(userTypeId);
		return list;
	}

	public List<UserTypes> selectAll() throws Exception {
		List<UserTypes> list = userTypesDao.selectAll();
		return list;
	}


}
